#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int n;
int a[2000];
int jump[4];

bool isin(int n)
{
    if (n % 7 == 0)
        return true;
    else
    {
        while (n != 0)
        {
            int temp = n % 10;
            if (temp == 7)
                return true;
            n /= 10;
        }
        return false;
    }
}

int main()
{
    cin >> n;
    int count = 0;
    for (int i = 1; i < 2000; i++)
    {
        a[i] = i;
        if (isin(i))
        {
            jump[i % 4]++;
        }
        else
        {
            count++;
            if (count == n)
                break;
        }
    }
    for (int i = 1; i < 4; i++)
    {
        cout << jump[i] << endl;
    }
    cout << jump[0] << endl;
    //system("pause");
}